package com.mhkj.check.controller;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.mhkj.check.entity.FineDetail;
import com.mhkj.check.service.FineDetailService;
import com.mhkj.check.service.PlanCheckService;
import com.mhkj.revise.plan.entity.PlanNode;
import com.mics.core.common.componet.JsonHandler;
import com.mics.core.common.componet.Pagination;
import com.mics.core.system.base.controller.BaseController;

/**
 * 计划考核
 * @author mics
 * @date 2018年8月23日
 * @version 1.0
 */
@Controller
@RequestMapping("/check")
public class PlanCheckController extends BaseController<PlanNode>{
	@Resource
	private PlanCheckService planCheckService;
	@Resource
	private FineDetailService fineDetailService;
	@Resource
	private JsonHandler jsonHandler;
	
	@RequestMapping("/keyListByPage")
	@ResponseBody
	public void keyListByPage(HttpServletResponse response,PlanNode planNode,String dateTemp,int pageIndex, int pageSize) {
		Pagination<PlanNode> pagination = planCheckService.checkListByPage(planNode,dateTemp,1, pageIndex, pageSize);
		jsonHandler.sendJsonString(response, true, "获取数据成功", pagination,new String[]{
				"id","NO","plan.name","business.typeName","nodeName","nodeProperty.value","completeStandard","deadline","deadlineDesc","rate","beginDate","endDate","remark","companyName","officeName","postName","overDay","rate","fineMoney","nodeProperty.value"},
				"id","NO","planName","business","nodeName","nodeProperty","completeStandard","deadline","deadlineDesc","rate","beginDate","endDate","remark","companyName","officeName","postName","overDay","rate","fineMoney","value");
	}

	@RequestMapping("/fruitArchivesDetailedListByPage")
	@ResponseBody
		public void fruitArchivesDetailedListByPage(HttpServletResponse response,FineDetail fineDetail,String dateTemp,int pageIndex, int pageSize) {
			Pagination<FineDetail> pagination = fineDetailService.fruitArchivesDetailedListByPage(fineDetail,dateTemp,1, pageIndex, pageSize);
		jsonHandler.sendJsonString(response, true, "获取数据成功", pagination,
				new String[]{"id", "rate", "day", "createDate", "money","name"},
				new String[]{"indexcolumn", "achievementName", "achievementNature", "achievementTime", "patternManifestation","uname"});
	}

	@RequestMapping("/mainListByPage")
	@ResponseBody
	public void mainListByPage(HttpServletResponse response,PlanNode planNode, String dateTemp,int pageIndex, int pageSize) {
		Pagination<PlanNode> pagination = planCheckService.checkListByPage(planNode,dateTemp,2, pageIndex, pageSize);
		jsonHandler.sendJsonString(response, true, "获取数据成功", pagination,new String[]{
				"id","NO","plan.name","business.typeName","nodeName","nodeProperty.value","completeStandard","deadline","deadlineDesc","rate","beginDate","endDate","remark","companyName","officeName","postName","overDay","rate","fineMoney","nodeProperty.value"},
				"id","NO","planName","business","nodeName","nodeProperty","completeStandard","deadline","deadlineDesc","rate","beginDate","endDate","remark","companyName","officeName","postName","overDay","rate","fineMoney","value");
	}
	
	@RequestMapping("/professionalListByPage")
	@ResponseBody
	public void professionallistByPage(HttpServletResponse response,PlanNode planNode,String dateTemp,int pageIndex, int pageSize) {
		Pagination<PlanNode> pagination = planCheckService.checkListByPage(planNode,dateTemp,3, pageIndex, pageSize);
		jsonHandler.sendJsonString(response, true, "获取数据成功", pagination,new String[]{
				"id","NO","plan.name","business.typeName","nodeName","nodeProperty.value","completeStandard","deadline","deadlineDesc","rate","beginDate","endDate","remark","companyName","officeName","postName","overDay","rate","fineMoney","nodeProperty.value"},
				"id","NO","planName","business","nodeName","nodeProperty","completeStandard","deadline","deadlineDesc","rate","beginDate","endDate","remark","companyName","officeName","postName","overDay","rate","fineMoney","value");
	}
	
	@RequestMapping("/monthListByPage")
	@ResponseBody
	public void monthListByPage(HttpServletResponse response,PlanNode planNode,String dateTemp,int pageIndex, int pageSize) {
		Pagination<PlanNode> pagination = planCheckService.checkListByPage(planNode,dateTemp,4, pageIndex, pageSize);
		jsonHandler.sendJsonString(response, true, "获取数据成功", pagination,new String[]{
				"id","NO","plan.name","business.typeName","nodeName","nodeProperty.value","completeStandard","deadline","deadlineDesc","rate","beginDate","endDate","remark","companyName","officeName","postName","overDay","rate","fineMoney","nodeProperty.value"},
				"id","NO","planName","business","nodeName","nodeProperty","completeStandard","deadline","deadlineDesc","rate","beginDate","endDate","remark","companyName","officeName","postName","overDay","rate","fineMoney","value");
	}
	
	@RequestMapping("/functionListByPage")
	@ResponseBody
	public void functionListByPage(HttpServletResponse response,PlanNode planNode,String dateTemp,int pageIndex, int pageSize) {
		Pagination<PlanNode> pagination = planCheckService.checkListByPage(planNode,dateTemp,5, pageIndex, pageSize);
		jsonHandler.sendJsonString(response, true, "获取数据成功", pagination,new String[]{
				"id","NO","plan.name","business.typeName","nodeName","nodeProperty.value","completeStandard","deadline","deadlineDesc","rate","beginDate","endDate","remark","companyName","officeName","postName","overDay","rate","fineMoney","nodeProperty.value"},
				"id","NO","planName","business","nodeName","nodeProperty","completeStandard","deadline","deadlineDesc","rate","beginDate","endDate","remark","companyName","officeName","postName","overDay","rate","fineMoney","value");
	}

	@RequestMapping("/info")
	@ResponseBody
	public void info(HttpServletResponse response,long id) {
		PlanNode planNode = planCheckService.getById(id);
		jsonHandler.sendJsonString(response, true, "获取数据成功", planNode,new String[]{
						"id","NO","plan.name","business.value","nodeName","nodeProperty.value","completeStandard","deadline","deadlineDesc","rate","beginDate","endDate","remark","companyName","officeName","postName","overDay","rate","fineMoney"},
				"id","NO","planName","business","nodeName","nodeProperty","completeStandard","deadline","deadlineDesc","rate","beginDate","endDate","remark","companyName","officeName","postName","overDay","rate","fineMoney");
	}

}
